using System.Data.Entity.ModelConfiguration;
using BL.Core.Domain.Customers;

namespace BL.Data.Mapping.Customers
{
    public partial class CustomerRoleMap : EntityTypeConfiguration<CustomerRole>
    {
        public CustomerRoleMap()
        {
            this.ToTable("CustomerRole");
            this.HasKey(cr => cr.Id);
            this.Property(cr => cr.Name).IsRequired().HasMaxLength(255);
            this.Property(cr => cr.SystemName).HasMaxLength(255);

            this.HasMany(cr => cr.Customers)
                .WithMany(c => c.CustomerRoles)
                .Map(m => m.ToTable("Customer_CustomerRole_Mapping"));
        }
    }
}